<?php
class category_post_model extends my_model{

	function __construct(){
		parent::__construct();
		$this->_prefix = "ctp";
		$this->_pk = "";
		$this->_column = array(
													'cat_id'	=>	$this->_prefix."_cat_id",
													'pos_id'	=>	$this->_prefix."_pos_id"
		);
		$this->_join_column = array(
								'id'								=> "pos_id",
								'title'							=> "pos_title",
								'content'						=> "pos_content",
								'usr_ip'						=> "pos_usr_ip",
								'status'						=> "pos_status",
								'comment_status'		=> "pos_comment_status",
								'usr_id'						=> "pos_usr_id",
								'cat_id'						=> "pos_cat_id",
								'typ_id'						=> "pos_typ_id",
								'cr_date'						=> "pos_cr_date",
								'lu_date'						=> "pos_lu_date",
								'lu_uid'						=> "pos_lu_uid",
								'update_date'				=> "pos_update_date",
								'url'								=> "pos_url",
								'type'							=> "pos_type",
								'code'							=> "pos_code",
								'view'							=> "pos_view",
								'username' 					=> "usr_username",
								'firstname' 				=> "usr_firstname",
								'lastname' 					=> "usr_lastname",
								'group' 						=> "usr_group",
								'mobile' 						=> "usr_mobile",
								'phone' 						=> "usr_phone",
								'email' 						=> "usr_email",
								'address' 					=> "usr_address",
								'district' 					=> "usr_district",
								'province' 					=> "usr_province",
								'zipcode' 					=> "usr_zipcode"
		);
	}
	function get($options = NULL){
    $this->db->join("ci_post","ci_category_post.ctp_pos_id = ci_post.pos_id");
    $this->db->join("ci_user","ci_user.usr_id = ci_post.pos_usr_id");
    $this->db->where("pos_type","post");
    $mainTable = parent::get($options);
    return $mainTable;
  }
}

?>